//
//  LoginAndRegisterViewController.m
//  CCJD
//
//  Created by foreveross－bj on 14/12/19.
//  Copyright (c) 2014年 foreveross－bj. All rights reserved.
//

#import "LoginAndRegisterViewController.h"
#import "LoginViewController.h"
#import "RegisterViewController.h"

@interface LoginAndRegisterViewController ()
{
    CGFloat width;
    CGFloat height;
}
@property (nonatomic, strong) UILabel *loginButton;      //登录按钮
@property (nonatomic, strong) UILabel *registerButton;   //注册按钮
@property (nonatomic, strong) UIImageView *iconImageView; //图标
@property (nonatomic, strong) UILabel *bigTitleLabel;     //大标题标签
@property (nonatomic, strong) UILabel *smallTitleLabel;   //小标题标签

@end

@implementation LoginAndRegisterViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    //添加背景图片
    UIImageView *backgroundImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"firstBackground"]];
    backgroundImageView.frame = self.view.frame;
    [self.view addSubview:backgroundImageView];
    
    width = self.view.frame.size.width;
    height = self.view.frame.size.height;
    
     [self addRegisterButton]; //添加注册按钮
    [self addLoginButton];    //添加登录按钮

}
/**
 * 添加注册按钮
 **/
- (void)addRegisterButton{
    self.registerButton = [[UILabel alloc] initWithFrame:CGRectMake(width * 1 / 5, height * 2 / 3 - 30, width * 1 / 5, width * 1 / 5)];
    _registerButton.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
    _registerButton.layer.cornerRadius = self.view.frame.size.width * 1 / 5 / 2;
    _registerButton.layer.masksToBounds = YES;
    _registerButton.font = [UIFont systemFontOfSize:20];
    _registerButton.text = @"注册";
    _registerButton.textColor = [UIColor whiteColor];
    _registerButton.textAlignment = NSTextAlignmentCenter;
    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(DoRegister:)];
    [_registerButton addGestureRecognizer:tapGesture];
    _registerButton.userInteractionEnabled = YES;
    [self.view addSubview:_registerButton];
}
/**
 * 点击注册按钮调用此方法，此方法实现跳转功能，进入注册页面。
 * @param button
 **/

- (void)DoRegister:(UITapGestureRecognizer *)tapGesture{
    RegisterViewController *registerVC = [[RegisterViewController alloc] init];
    [self presentViewController:registerVC animated:YES completion:nil];
}

/**
 * 添加登录按钮
 **/
- (void)addLoginButton{
    self.loginButton = [[UILabel alloc] initWithFrame:CGRectMake(width * 3 / 5, height * 2 / 3 - 30,width * 1 / 5, width * 1 / 5)];
    _loginButton.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
    _loginButton.layer.cornerRadius = self.view.frame.size.width * 1 / 5 / 2;
    _loginButton.layer.masksToBounds = YES;
    _loginButton.font = [UIFont systemFontOfSize:20];
    _loginButton.text = @"登录";
    _loginButton.textColor = [UIColor whiteColor];
    _loginButton.textAlignment = NSTextAlignmentCenter;
    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(DoLogin:)];
    [_loginButton addGestureRecognizer:tapGesture];
    _loginButton.userInteractionEnabled = YES;
    [self.view addSubview:_loginButton];
}
/**
 * 点击登录按钮调用此方法，此方法实现跳转功能，进入注册页面。
 * @param tapGesture
 **/

- (void)DoLogin:(UITapGestureRecognizer *)tapGesture{
    LoginViewController *loginVC = [[LoginViewController alloc] init];
    [self presentViewController:loginVC animated:YES completion:nil];
}

/**
 * 改变状态栏前景色
 * @return UIStatusBarStyle
 **/
- (UIStatusBarStyle)preferredStatusBarStyle{
    return UIStatusBarStyleLightContent;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
